/**
 *  iBizSys 5.0 机器人生产代码（不要直接修改当前代码）
 *  http://www.ibizsys.net
 */
package com.sa.litetwo.app.card.ctrlhandler;


import java.util.ArrayList;
import java.util.List;
import net.ibizsys.paas.util.StringHelper;
import net.ibizsys.paas.web.WebContext;
import net.ibizsys.paas.demodel.DEModelGlobal;
import net.ibizsys.paas.demodel.IDataEntityModel;
import net.ibizsys.paas.service.IService;
import net.ibizsys.paas.service.ServiceGlobal;

import com.sa.litetwo.app.srv.card.ctrlmodel.GG_GRDPOSTMainEditFormModel;
import com.sa.litetwo.srv.card.demodel.GG_GRDPOSTDEModel;
import com.sa.litetwo.srv.card.service.GG_GRDPOSTService;
import com.sa.litetwo.srv.card.dao.GG_GRDPOSTDAO;
import com.sa.litetwo.srv.card.entity.GG_GRDPOST;

import net.ibizsys.paas.ctrlmodel.IEditFormModel;
import net.ibizsys.paas.entity.IEntity;
import net.ibizsys.paas.sysmodel.ISystemRuntime;
import net.ibizsys.paas.ctrlhandler.IFormItemHandler;
import net.ibizsys.paas.ctrlhandler.IFormItemUpdateHandler;

public class GG_GRDPOSTEditViewEditFormHandler extends net.ibizsys.paas.ctrlhandler.EditFormHandlerBase{
   
    protected GG_GRDPOSTMainEditFormModel editformModel = null;
    public GG_GRDPOSTEditViewEditFormHandler()  {
        super();
    }

    @Override
    protected void onInit() throws Exception
    {

        editformModel  = (GG_GRDPOSTMainEditFormModel)this.getViewController().getCtrlModel("form");
        super.onInit();
    }

       @Override
	protected IEditFormModel getEditFormModel()
	{
		return this.getRealEditFormModel();
	}
    
    protected GG_GRDPOSTMainEditFormModel getRealEditFormModel(){
    	return this.editformModel ;
    }

       protected GG_GRDPOSTService getRealService(){
            return (GG_GRDPOSTService)this.getService();
       }

       
       /**
	 * 准备部件操作数据访问能力
	 * @throws Exception
	 */
        @Override
	protected void prepareDataAccessActions()throws Exception
	{
              super.prepareDataAccessActions();
             this.registerDataAccessAction("update","UPDATE");
             this.registerDataAccessAction("loaddraftfrom","CREATE");
             this.registerDataAccessAction("remove","DELETE");
             this.registerDataAccessAction("load","READ");
             this.registerDataAccessAction("loaddraft","CREATE");
             this.registerDataAccessAction("create","CREATE");
         }



       /**
	 * 准备部件成员处理对象
	 * @throws Exception
	 */
        @Override
	protected void prepareCtrlItemHandlers()throws Exception
	{
             super.prepareCtrlItemHandlers();

             ISystemRuntime iSystemRuntime = (ISystemRuntime)this.getSystemModel();

	}
        
      @Override
    protected IEntity getEntity(Object objKeyValue)throws Exception
    {
    	GG_GRDPOST entity = new GG_GRDPOST();
        entity.set(GG_GRDPOST.FIELD_GG_GRDPOSTID,objKeyValue);
        this.getRealService().executeAction(GG_GRDPOSTService.ACTION_GET,entity);
        return entity;
    }
    
    @Override
    protected String getGetEntityAction(){
        return GG_GRDPOSTService.ACTION_GET;
    }

    @Override
    protected IEntity updateEntity(IEntity iEntity)throws Exception
    {
        this.getRealService().executeAction(GG_GRDPOSTService.ACTION_UPDATE,iEntity);
        return iEntity;
    }

      @Override
    protected IEntity getDraftEntity()throws Exception
    {
    	GG_GRDPOST entity = new GG_GRDPOST();
        fillDefaultValues(entity ,false);
        this.getRealService().executeAction(GG_GRDPOSTService.ACTION_GETDRAFT,entity);
        return entity;
    }

      @Override
     protected IEntity getDraftEntityFrom(Object objKeyValue)throws Exception
    {
    	GG_GRDPOST entity = new GG_GRDPOST();
        entity.set(GG_GRDPOST.FIELD_GG_GRDPOSTID,objKeyValue);
        this.getRealService().executeAction(GG_GRDPOSTService.ACTION_GETDRAFTFROM,entity);
        return entity;
    }

    @Override
    protected IEntity createEntity(IEntity iEntity)throws Exception
    {
        this.getRealService().executeAction(GG_GRDPOSTService.ACTION_CREATE,iEntity);
        return iEntity;
    }


      @Override
    protected void removeEntity(Object objKeyValue)throws Exception
    {
    	GG_GRDPOST entity = new GG_GRDPOST();
        entity.set(GG_GRDPOST.FIELD_GG_GRDPOSTID,objKeyValue);
        this.getRealService().executeAction(GG_GRDPOSTService.ACTION_REMOVE,entity);
    }
 

}